package yaner.hotel.manager.resource.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yaner.hotel.manager.common.dto.room.RoomAddDto;
import yaner.hotel.manager.common.dto.room.RoomDto;
import yaner.hotel.manager.common.dto.room.RoomUpdateDto;
import yaner.hotel.manager.common.vo.ResponseVo;
import yaner.hotel.manager.common.vo.RoomVo;
import yaner.hotel.manager.resource.service.IRoomService;

import java.util.List;

/**
 * @Author kf-leig
 * @Description: 房间管理
 * @Version 1.0
 * @Date 2024年05月22日11:31:00
 */
@RestController
public class RoomController {
    @Autowired
    private IRoomService roomService;

    @PostMapping("/room-list")
    public ResponseVo<List<RoomVo>> roomList(@RequestBody RoomDto roomDto){
        List<RoomVo> roomVos = roomService.roomList(roomDto);
        return ResponseVo.success(roomVos);
    }

    @GetMapping("get-room-info")
    public ResponseVo<RoomVo> getRoomInfo(@RequestParam("roomId") String roomId){
        RoomVo roomVo = roomService.getRoomInfo(roomId);
        return ResponseVo.success(roomVo);
    }

    @PostMapping("add-room-info")
    public ResponseVo<String> addRoomInfo(@RequestBody RoomAddDto roomAddDto){
        String s = roomService.addRoomInfo(roomAddDto);
        return ResponseVo.success(s);
    }

    @PostMapping("update-room-info")
    public ResponseVo<String> updateRoomInfo(@RequestBody RoomUpdateDto roomUpdateDto){
        String s = roomService.updateRoomInfo(roomUpdateDto);
        return ResponseVo.success(s);
    }

    @DeleteMapping("delete-room-info")
    public ResponseVo<String> deleteRoomInfo(@RequestParam("roomId") String roomId){
        String s = roomService.deleteRoomInfo(roomId);
        return ResponseVo.success(s);
    }
}
